﻿namespace Behemoth.SharePoint.Utilities {

    using System;
    using System.Collections.Generic;
    using System.Text;

    using Behemoth.Configuration;
    using Behemoth.SharePoint.Configuration;
    using Microsoft.SharePoint;

    public class CustomPropertyRepairFeatureProperties : SPFeaturePropertyReaderBase {

        public CustomPropertyRepairFeatureProperties(SPFeatureReceiverProperties props) : base(props) { }

        private static char[] delim = new char[] { ';' };

        [StrongTypeConfigEntryAttribute("FieldPropertyDefinitionFile", true)]
        private string fieldPropertyDefinitionFiles = string.Empty;
        private List<string> fieldPropertyDefinitionFileList = null; 
        public List<string> FieldPropertyDefinitionFiles {
            get {
                if (fieldPropertyDefinitionFileList == null) {
                    string[] filePaths = fieldPropertyDefinitionFiles.Split(delim);
                    fieldPropertyDefinitionFileList = new List<string>(filePaths);
                }
                return fieldPropertyDefinitionFileList;
            }
            set {
                fieldPropertyDefinitionFileList = value;
                string[] filePaths = fieldPropertyDefinitionFileList.ToArray();
                fieldPropertyDefinitionFiles = string.Join(delim[0].ToString(), filePaths);
            }
        }

    } // class

} // namespace
